<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var reg1=/\w{6,12}/;
        var reg2=/^\w{6,12}$/;
        var username="zhangsan";
        var reg3=/^\w{6,12}$/
        var result= reg3.test(username)
        console.log(result);
    </script>
</body>
</html>